home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / termsorc.lha / Extras / Source / gtlayout-source.lha / LTP_DrawPicker.c < prev    next >
C/C++ Source or Header  |  1995-09-24  |  1KB  |  55 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1995 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. */
  6.  
  7. #include "gtlayout_global.h"
  8.  
  9. VOID __regargs
  10. LTP_DrawPicker(struct RastPort *RPort,BOOLEAN UpDirection,LONG Left,LONG Top,LONG Width,LONG Height)
  11. {
  12.     LONG i,Len,ArrowHeight,ArrowWidth,LineHeight,Start;
  13.  
  14.     LineHeight    = (Height + 15) / 16;
  15.     ArrowHeight    = Height - (Height + 7) / 8;
  16.     ArrowWidth    = Width;
  17.  
  18.     if(UpDirection)
  19.     {
  20.         for(i = 0 ; i < ArrowHeight ; i++)
  21.         {
  22.             Len    = ((ArrowWidth * (i + 1)) / ArrowHeight) & ~1;
  23.  
  24.             if(Len < ArrowWidth)
  25.                 Len++;
  26.  
  27.             Start    = Left + (ArrowWidth - Len) / 2;
  28.  
  29.             Move(RPort,Start,Top + i);
  30.             Draw(RPort,Start + Len - 1,Top + i);
  31.         }
  32.     }
  33.     else
  34.     {
  35.         for(i = 0 ; i < ArrowHeight ; i++)
  36.         {
  37.             Len    = ((ArrowWidth * (i + 1)) / ArrowHeight) & ~1;
  38.  
  39.             if(Len < ArrowWidth)
  40.                 Len++;
  41.  
  42.             Start    = Left + (ArrowWidth - Len) / 2;
  43.  
  44.             Move(RPort,Start,Top + ArrowHeight - 1 - i);
  45.             Draw(RPort,Start + Len - 1,Top + ArrowHeight - 1 - i);
  46.         }
  47.     }
  48.  
  49.     for(i = 0 ; i < LineHeight ; i++)
  50.     {
  51.         Move(RPort,Left,Top + Height - 1 - i);
  52.         Draw(RPort,Left + Width - 1,Top + Height - 1 - i);
  53.     }
  54. }
  55.